package com.example.finance_oa.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.comment_oa.pojos.Process;
import com.example.comment_oa.pojos_vo.AdditionalVo;
import com.example.comment_oa.pojos_vo.AdjustVo;
import com.example.comment_oa.pojos_vo.ProcessVo;
import com.example.finance_oa.mapper.AdditionalMapper;
import com.example.finance_oa.mapper.AdjustMapper;
import com.example.finance_oa.service.ProcessService;
import com.example.finance_oa.mapper.ProcessMapper;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jin
 * @description 针对表【process】的数据库操作Service实现
 * @createDate 2022-10-20 14:52:24
 */
@Service
public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process>
        implements ProcessService{
    @Autowired
    ProcessMapper processMapper;
    @Autowired
    AdditionalMapper additionalMapper;
    @Autowired
    AdjustMapper adjustMapper;

    @Override
    public List<Process> allProcess(ProcessVo processVo) {
        return processMapper.allProcess(processVo);
    }

    //新增追加流程
    @Override
    public int insertZjlc(AdditionalVo additionalVo) {

        additionalVo.setAdditionalId(additionalVo.getProcessBh());

        processMapper.insertZjlc(additionalVo);
        additionalMapper.insertAll(additionalVo);

        return 0;
    }
    //新增预算变更流程
    @Override
    public int insertBglc(AdjustVo adjustVo) {
        adjustVo.setAdjustId(adjustVo.getProcessBh());
        processMapper.insertBglc(adjustVo);
        adjustMapper.insertAll(adjustVo);

        return 0;
    }

    @Override
    public List<Process> selectBybh(String processBh) {
        return processMapper.selectAllByProcessBh(processBh);
    }

    @Override
    public List<Process> selectBybh2(String processBh) {
        return processMapper.selectAllByProcessBh2(processBh);
    }
}




